package controller

import (
	"fmt"
	"ginDemo/interfaces"
	"ginDemo/interfaces/impl"
	"ginDemo/model"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Hello(ctx *gin.Context)  {
	myfloat:= impl.Myfloat(-100.25)
	var abser interfaces.Abser
	abser = myfloat
	fmt.Println(abser.Abs())


	name := "xuweijie"
	ctx.HTML(200, "index/index.html", name)
}

func User(ctx *gin.Context)  {
	ctx.HTML(200, "user/user.html", "许伟杰")
}

// UserInfoStruct /**
func UserInfoStruct(ctx *gin.Context)  {
	userInfo := model.UserInfo{Id: 1, Name: "许伟杰", Age: 27, Addr: "广东茂名"}
	ctx.HTML(http.StatusOK, "userInfo/userInfo.html", userInfo)
}

/*
数组赋值
 */
func ArrControl(ctx *gin.Context) {
	arr := [3]int{1, 2, 3}
	ctx.HTML(http.StatusOK, "arr/arr.html", arr)
}

func MapController(ctx *gin.Context)  {
	map_data := map[string]string{"name":"vic", "sex":"man"}
	ctx.HTML(http.StatusOK, "arr/arr.html", map_data)
}
